﻿using System;
using System.Linq;
using System.Reflection;

namespace GDM.Hogar.Soporte.Helpers
{
    public static class ReflectionExtensions
    {
        public static TAttr GetFirstAttribute<TAttr>(this PropertyInfo source) where TAttr : Attribute
        {
            var attrs = source.GetCustomAttributes(typeof(TAttr), true).Select(o => (TAttr)o);

            var attr = attrs.FirstOrDefault();
            return attr;
        }
    }
}